package gen.core.utils;

import org.apache.commons.lang.StringUtils;

public class NameUtils {
	/**
	 * DATA_OBJECT_NAME -> dataObjectName
	 * 
	 * @return
	 */
	public static String convert1(String objName) {
		StringBuilder result = new StringBuilder();

		String[] tokens = objName.split("_");
		for (String token : tokens) {
			if (result.length() == 0)
				result.append(token.toLowerCase());
			else
				result.append(StringUtils.capitalize(token.toLowerCase()));
		}

		return result.toString();
	}

	/**
	 * DATA_OBJECT_NAME -> DataObjectName
	 * 
	 * @return
	 */
	public static String convert2(String objName) {
		StringBuilder result = new StringBuilder();

		String[] tokens = objName.split("_");
		for (String token : tokens) {
			result.append(StringUtils.capitalize(token.toLowerCase()));
		}

		return result.toString();
	}

}
